/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package headquarters;

import javax.ejb.EJB;
import javax.ejb.MessageDriven;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

/**
 *
 * @author Marcin Bełzowski
 * MDB odbiera komunikaty od samochodów
 */
@MessageDriven(mappedName = "jms/Queue")
public class CarInfoColectorBean implements MessageListener {
    @EJB  CarInfoDateLocal carInfoDate;
    public CarInfoColectorBean() {
    }

    public void onMessage(Message message) {
        
        if (message instanceof  TextMessage) {
            
            TextMessage textM = (TextMessage)message;
          
            carInfoDate.parse(textM);
        }
    }
    
}
